package com.scx.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.scx.entity.SetmealBook;
import com.scx.vo.BookItemVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealBookMapper extends BaseMapper<SetmealBook> {

    /**
     * 根据套餐id查询图书选项
     * @param setmealId
     * @return
     */
    @Select("select sd.name, sd.copies, d.image, d.description " +
            "from setmeal_dish sd left join dish d on sd.dish_id = d.id " +
            "where sd.setmeal_id = #{setmealId}")
    List<BookItemVO> getBookItemBySetmealId(Long setmealId);
}
